package sk.demo.dao.impl;

import org.springframework.stereotype.Repository;
import sk.demo.Ref;
import sk.demo.dao.base.MessageBaseDao;
import sk.demo.dao.intf.MessageDao;
import sk.demo.entity.MessageEntity;
import sk.demo.wrapper.MessageQuery;

import java.util.List;

/**
 * MessageDaoImpl: 数据操作接口实现
 *
 * 这只是一个减少手工创建的模板文件
 * 可以任意添加方法和实现, 更改作者和重定义类名
 * <p/>@author Powered By Fluent Mybatis
 */
@Repository
public class MessageDaoImpl extends MessageBaseDao implements MessageDao {
    @Override
    public List<MessageEntity> selectAll() {
        MessageQuery query = new MessageQuery();
        return this.listEntity(query);
    }

    @Override
    public List<MessageEntity> last(int size) {
        MessageQuery query = new MessageQuery();
        query.orderBy.mesId().desc();
        query.limit(size);
        return this.listEntity(query);
    }
}
